
//����������
package com.creawor.hz_market.t_balance_office;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Session;
import net.sf.hibernate.Hibernate;
import net.sf.hibernate.LockMode;
//import oracle.sql.CLOB;
import com.creawor.imei.base.AbsEditMap;

public class t_balance_office_EditMap extends AbsEditMap {

public void add(t_balance_office_Form vo) throws HibernateException {
t_balance_office po=new t_balance_office();
  try{
    po.setId(java.lang.Integer.parseInt(vo.getId()));
   
  }catch (Exception e) {
   e.printStackTrace();
  }
  
  try{
	  po.setCode(vo.getCode());
  }catch(Exception e){
	  
  }

  try{
   po.setName(vo.getName());
  }catch (Exception e) {
   e.printStackTrace();
  }

  try{
   po.setAddress(vo.getAddress());
  }catch (Exception e) {
   e.printStackTrace();
  }

  try{
   po.setParent_code(vo.getParent_code());
  }catch (Exception e) {
   e.printStackTrace();
  }

  try{
   po.setCompany(vo.getCompany());
  }catch (Exception e) {
   e.printStackTrace();
  }
  try{
    po.setX((vo.getX()));
 }catch (Exception e) {
   e.printStackTrace();
 }
  try{
    po.setY((vo.getY()));
 }catch (Exception e) {
   e.printStackTrace();
 }

		Session session = this.beginTransaction();
try {
	session.save(po);

	this.endTransaction(true);
} catch (Exception e) {
	this.endTransaction(false);
	e.printStackTrace();
   throw new HibernateException(e);}	
}

public void delete(t_balance_office_Form vo) throws HibernateException {
String id = vo.getId();
delete(id);
}

public void delete(String id) throws HibernateException {
Session session = this.beginTransaction();
try{
 t_balance_office po =(t_balance_office) session.load(t_balance_office.class, new Integer(id));
 session.delete(po);
 this.endTransaction(true);
} catch (HibernateException e) {
  e.printStackTrace();
  this.endTransaction(false);
}
}

public void update(t_balance_office_Form vo) throws HibernateException {
	Session session = this.beginTransaction();
   String id = vo.getId();
   t_balance_office po =(t_balance_office) session.load(t_balance_office.class, new Integer(id));
  try{
    po.setId(java.lang.Integer.parseInt(vo.getId()));
  }catch (Exception e) {
   e.printStackTrace();
  }

  try{
   po.setName(vo.getName());
  }catch (Exception e) {
   e.printStackTrace();
  }

  try{
   po.setAddress(vo.getAddress());
  }catch (Exception e) {
   e.printStackTrace();
  }

  try{
   po.setParent_code(vo.getParent_code());
  }catch (Exception e) {
   e.printStackTrace();
  }

  try{
   po.setCompany(vo.getCompany());
  }catch (Exception e) {
   e.printStackTrace();
  }
  try{
    po.setX((vo.getX()));
 }catch (Exception e) {
   e.printStackTrace();
 }
  try{
    po.setY((vo.getY()));
 }catch (Exception e) {
   e.printStackTrace();
 }

try {
	session.update(po);

	this.endTransaction(true);
} catch (Exception e) {
	this.endTransaction(false);
	e.printStackTrace();
   throw new HibernateException(e);  }
}

}
//����������
